﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IdentityModel.Selectors;
using System.IdentityModel.Tokens;

namespace Revis.VClinicNet.UI.External.Client.Security
{
    public class VClinicCertificateValidator : X509CertificateValidator
    {
        public override void Validate(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate)
        {
            if (certificate == null) {
                throw new ArgumentNullException("Certificate is null");
            }
            if (certificate.SubjectName.Name != "CN=VClinicNetCert") {
                throw new SecurityTokenException("Untrusted certificate");
            }
        }
    }
}
